package com.xuzao.developer.service.impl;

import com.github.pagehelper.PageInfo;
import com.xuzao.developer.base.model.PlanUpdateLog;
import com.xuzao.developer.vo.BaseResultVo;
import com.xuzao.developer.tools.entity.Pager;
import com.xuzao.developer.dao.PlanUpdateLogDao;
import com.xuzao.developer.dto.PlanUpdateLogDTO;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.xuzao.developer.service.PlanUpdateLogService;


/**
 * @description 
 * @author xuzao
 * @date 2019-08-22 11:44:48
 **/
@Service("planUpdateLogService")
public class PlanUpdateLogServiceImpl implements PlanUpdateLogService {

	@Resource
	private PlanUpdateLogDao planUpdateLogDao;

	@Override
	public PageInfo<PlanUpdateLog> list(PlanUpdateLogDTO dto, Pager pager) {
		return planUpdateLogDao.list(dto, pager);
	}

	@Override
	public BaseResultVo insert(PlanUpdateLogDTO dto) {
		PlanUpdateLog planUpdateLog = new PlanUpdateLog();
		//TODO 赋值
		Integer count = planUpdateLogDao.insertSelective(planUpdateLog);
		if (count > 0) {
			return BaseResultVo.success();
		}
		return BaseResultVo.error();

	}

	@Override
	public BaseResultVo update(PlanUpdateLogDTO dto) {
		PlanUpdateLog planUpdateLog = new PlanUpdateLog();
		//TODO 赋值
		Integer count = planUpdateLogDao.updateSelectiveById(planUpdateLog);
		if (count > 0) {
			return BaseResultVo.success();
		}
		return BaseResultVo.error();
	}

	@Override
	public BaseResultVo get(PlanUpdateLogDTO dto) {
		PlanUpdateLog planUpdateLog = new PlanUpdateLog();
		return BaseResultVo.success(planUpdateLogDao.selectById(planUpdateLog.getId()));
	}
}